﻿Imports System.Data.OleDb
Public Class Questions
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub Btn_quest_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Btn_quest.Click
        Dim oleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("booksConn").ConnectionString)

        oleDbConn.Open()
        
        Dim sql As String = "INSERT INTO Questions(Traveller,Question,askedDate) VALUES (@f1,@f2,@f3)"

        Dim cmd As OleDbCommand = New OleDbCommand(sql, oleDbConn)
        cmd.CommandType = CommandType.Text
        cmd.Parameters.AddWithValue("@f1", User.Identity.Name)
        cmd.Parameters.AddWithValue("@f2", Tb_quest.Text)
        cmd.Parameters.AddWithValue("@f3", Convert.ToString(DateAndTime.Now))
        cmd.ExecuteNonQuery()
        oleDbConn.Close()
        Response.Redirect("Questions.aspx?ID=" & Request.Params("ID"))

    End Sub
End Class